import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import postcssPxtorem from 'postcss-pxtorem' // 引入 postcss-pxtorem

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  css: {
    postcss: {
      plugins: [
        postcssPxtorem({
          rootValue: 16, // 基准值
          propList: ['*'], // 所有属性都转换
          selectorBlackList: ['.norem'] // 过滤掉.norem开头的class
        })
      ]
    }
  }
})
